package com.thoughtworks;

import java.util.HashMap;

public class UserDetails {
    public HashMap<String, Integer> mapUser = new HashMap<String, Integer>();

    public String userName[] = {"Shravan", "Sanjay", "Rahul"};
    public String emailId[] = {"shravan@gmail.com", "sanjay@hotmail.com", "rahul@live.com"};
    public String phoneNumber[] = {"9956728983", "7268376489", "8746721658"};

    public String[] userInfo(String s) {
        int index = -1;
        mapUser.put("123-0001", 0);
        mapUser.put("123-0002", 1);
        mapUser.put("123-0003", 2);
        for (String identify : mapUser.keySet())
            if (identify.equals(s)) {
                index = mapUser.get(identify);
                break;
            }
        String userDetails[] = new String[3];
        if (index != -1) {
            userDetails[0] = userName[index];
            userDetails[1] = emailId[index];
            userDetails[2] = phoneNumber[index];
        }
        return userDetails;
    }
}
